import java.util.Random;
import java.util.Scanner;

public class add {
    //    折叠
    public static int addNum() {
        double i = 0.1;
        int sum = 0;
        for (; i <= 8844430; ) {
            i *= 2;
            sum++;
            System.out.println("第" + sum + "次折叠到了" + i + "mm");
        }
        return sum;
    }

    //回文数字
    public static void reverse() {
        Scanner sc = new Scanner(System.in);
        System.out.print("输入需要判断的数字:");
        int num = sc.nextInt();
        int x = num;
        int reNum = 0;
        while (x > 0) {
            int y = x % 10;
            reNum = reNum * 10 + y;
            x = x / 10;
        }
        if (num == reNum) {
            System.out.println("是回文字");
        } else {
            System.out.println("不是回文字");
        }
    }

    //    除法
    public static void except() {
        Scanner sc = new Scanner(System.in);
        int a;
        int b;
        System.out.print("输入被除数:");
        a = sc.nextInt();
        System.out.print("输入除数:");
        b = sc.nextInt();
        int res = 0;
        int rem;
        while (a >= b) {
            res++;
            a -= b;
        }
        ;
        rem = a;
        System.out.println("商为:" + res + " " + "余数为:" + rem);
    }

    // 逢7过
    public static void passSeven() {
        Scanner sc = new Scanner(System.in);
        for (int i = 1; i <= 100; i++) {
            if ((i % 7 == 0) || (i % 10 == 7) || ((i / 10) % 10 == 7)) {
                System.out.println("过");
            } else {
                System.out.println(i);
            }
        }
    }

    //    平方根
    public static void sqrt() {
        Scanner sc = new Scanner(System.in);
        System.out.print("输入大于2的正整数查询平方根:");
        int x = sc.nextInt();
        for (int i = 1; i < x; i++) {
            if (i * i == x) {
                System.out.println(i + "是" + x + "的平方根");
                break;
            } else if (i * i > x) {
                System.out.println(i - 1 + "是" + x + "的平方根的整数部分");
                break;
            }
        }
    }

    // 判断质数
    public static void prime() {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int count = 0;
        boolean flag = true;
        for (int i = 2; i < Math.sqrt(x); i++) {
            count++;
            if (x % i == 0) {
                System.out.println(x + "不是质数");
                flag = false;
                break;
            }
        }
        if (flag) {
            System.out.println("循环" + count + "次后发现" + x + "是质数");
        }
    }

    //    猜数字
    public static void rand() {
        Scanner sc = new Scanner(System.in);
        Random rd = new Random();
        int x = rd.nextInt(100);//0-99
        int z = rd.nextInt(100) + 100;//100-199
        int y;
        int i = 10;
        System.out.println("随机数已生成，请猜(10次机会)");
        while (i > 0) {
            y = sc.nextInt();
            if (y == x) {
                System.out.println("猜中了!数字就是" + x);
                i--;
                break;
            } else if (y > x) {
                i--;
                if (i > 0) {
                    System.out.println("猜大了，再想想,还剩" + i + "次机会");
                }
            } else if (y < x) {
                i--;
                System.out.println("猜小了，再想想,还剩" + i + "次机会");
            }
        }
        ;
        if (i == 0) {
            System.out.println("您已猜错10次，您是降温罩吗这么蔡");
        } else {
            System.out.println("您猜对了！，您一定是陆润肌吧！");
        }
    }

    void sb() {
        System.out.println("sb");
    }
}

